package logic

import (
	"context"
	"doctor-medicine-system/modles/mysql"

	"doctor-medicine-system/doctorrpc/doctorrpc"
	"doctor-medicine-system/doctorrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type StaticListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewStaticListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StaticListLogic {
	return &StaticListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *StaticListLogic) StaticList(in *doctorrpc.StaticListRequest) (*doctorrpc.StaticListResponse, error) {
	// todo: add your logic here and delete this line

	var static mysql.Static

	var list []*doctorrpc.StaticList

	static.FindByStatic(mysql.DB, list, in.UserID)

	return &doctorrpc.StaticListResponse{
		List: list,
	}, nil
}
